import Mock from 'mockjs'

Mock.mock(`${window.$mockApi}/Role/Create`, "post", () => {
    let back = {}
    back = {
        result: {
            description: "",
            displayName: "test",
            grantedPermissions: ["System", "System.RoleManage", "System.AdminManage"],
            id: 6,
            isDefault: false,
            isStatic: false,
            name: "44e34a72c4424434aa4c771ec91d3168"
        },
        success: true,
        status: 200
    }
    return back
})

Mock.mock(`${window.$mockApi}/Role/Get`, "post", () => {
    let back = {}
    back = {
        "result": { "name":"Admin", "displayName":"系统管理员", "description":null, "isStatic":true, "isDefault":true, "grantedPermissions": ["System.RoleManage","System.HandleLogs","System","System.Config","System.LoginLogs"],"id": 1},
        "targetUrl":null,
        "success":true,
        "error":null
    }
    return back
})

Mock.mock(`${window.$mockApi}/Role/GetAllPermissions`, "post", () => {
    let back = {}
    back = {
        result: {
            totalCount: 5,
            items: [
                {
                    "id":0,
                    "name":"System","displayName":"系统管理","description":null,"children":[
                        {"name":"System.Config","displayName":"系统配置","description":null,"children":[],"id":0},
                        {"name":"System.RoleManage","displayName":"角色管理","description":null,"children":[],"id":0},
                        {"name":"System.AdminManage","displayName":"用户管理","description":null,"children":[],"id":0},
                        {"name":"System.LoginLogs","displayName":"登录记录","description":null,"children":[],"id":0},
                        {"name":"System.HandleLogs","displayName":"操作记录","description":null,"children":[],"id":0}
                    ]
                }
            ]
        },
        targetUrl: null,
        success: true,
        error: null
    }
    return back
})

Mock.mock(`${window.$mockApi}/Role/GetPagedList`, "post", () => {
    let back = {}
    back = {
        result: {
            totalCount: 5, 
            items: [
                { name: "2a65d4030a0e4a059e797a3e20e7c3df", displayName: "加菲猫", isDefault: false, creationTime: "2019-09-11 10:54:57", id: 3},
                { name: "44e34a72c4424434aa4c771ec91d3168", displayName: "蓝精灵", isDefault: false, creationTime: "2019-09-24 16:36:13", id: 6},
                { name: "54e34a72c8824434aa4c771ec91d9872", displayName: "恐龙大冒险", isDefault: true, creationTime: "2019-07-02 16:20:35", id: 1},
                { name: "ccc95bb3cc7d4a74805fbe2594caa750", displayName: "亨特尔故事", isDefault: false, creationTime: "2019-09-11 15:32:52", id: 5},
                { name: "eb6f81540cd54837a9eed67eefa79f32", displayName: "系统管理员", isDefault: true, creationTime: "2019-09-11 10:38:36", id: 2}
            ]
        },
        targetUrl: null,
        success: true,
        error: null
    }
    return back
})

Mock.mock(`${window.$mockApi}/Role/Update`, "post", () => {
    let back = {}
    back = {
        "result": {
            "name":"eb6f81540cd54837a9eed67eefa79f32","displayName":"chenxu","description":"","isStatic":false,"isDefault":true,
            "grantedPermissions":["System.RoleManage","System.HandleLogs","System","System.Config","System.LoginLogs"],
            "id":2
        },
        "targetUrl":null,
        "success":true,
        "error":null 
    }
    return back
})

Mock.mock(`${window.$mockApi}/Role/Delete`, "post", () => {
    let back = {}
    back = {"result":null,"targetUrl":null,"success":true,"error":null}
    return back
})

Mock.mock(`${window.$mockApi}/Role/Deletes`, "post", () => {
    let back = {}
    back = {"result":null,"targetUrl":null,"success":true,"error":null}
    return back
})

export default Mock
